{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "bab3bf3f-fa2a-4402-8aae-ef8256fedc9d", "metadata": { "editable": true, "nbsphinx": "hidden", "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "%matplotlib inline\n", "%config InlineBackend.figure_format = 'svg'\n", "\n", "import numpy as np\n", "from triqs.operators import Operator, n\n", "from triqs.gf import MeshImFreq, MeshImTime, Gf, make_gf_from_fourier, iOmega_n, inverse, Fourier\n", "from triqs.plot.mpl_interface import oplot, oploti, oplotr, plt" ] }, { "cell_type": "markdown", "id": "acf8653d-37dd-4636-b45b-b177cef08f6f", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "# One-boson retarded interaction\n", "\n", "To showcase the ability to treat retarded interactions in **TRIQS/ctseg**, we consider the minimal discrete model with one fermion (0) coupled to a fermionic bath state (1) as well as a boson\n", "\n", "$$\n", "H = \\epsilon_0 c^\\dagger_0 c_0 + \\epsilon_1 c^\\dagger_1 c_1 \n", "+ V (c^\\dagger_1 c_0 + c^\\dagger_0 c_1)\n", "+ g (b + b^\\dagger)c^\\dagger_0 c_0\n", "+ \\omega_0 b^\\dagger b\n", "\\, .\n", "$$\n", "\n", "Integrating out the bath fermion and the boson gives the single fermion action \n", "$$\n", "\\mathcal{S} = \n", "\\int_0^\\beta d\\tau H_{0}(\\tau) \n", "+ \n", "\\iint_0^\\beta d\\tau d\\tau' c_0^\\dagger(\\tau) \\Delta(\\tau - \\tau') c_0(\\tau)\n", "+\n", "\\iint_0^\\beta d\\tau d\\tau' n_0^\\dagger(\\tau) \\mathcal{U}(\\tau - \\tau') n_0(\\tau)\n", "$$\n", "with $H_{0} = \\epsilon_0 c^\\dagger_0 c_0$, retarded hybridization \n", "$\\Delta(i\\nu_n) = \\frac{V^2}{i\\nu_n - \\epsilon_1}$,\n", "and retarded interaction $\\mathcal{U}(i\\omega_n) = - 2 g^2 \\frac{\\omega_0}{\\omega_0^2 - (i\\omega_n)^2} \\,.$\n", "\n", "The fermionic Green's function $G_0(\\tau) = - \\langle \\mathcal{T} c_0(\\tau) c_0\\rangle$ of the action $\\mathcal{S}$ can be computed numerically exactly using **TRIQS/ctseg**, and (since the number of states is finite) also using exact diagonalization of $H$. " ] }, { "cell_type": "markdown", "id": "8d15b5db-3a8a-49ba-a141-15a32c73c6a0", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "## Simulating the retarded action $\\mathcal{S}$\n", "\n", "To compute the fermionic Green's function $G_0(\\tau)$ with **TRIQS/ctseg** we\n", "\n", "**1.** set up the system parameters, $\\epsilon_0$, $\\epsilon_1$, $V$, $g$, and $\\omega_0$," ] }, { "cell_type": "code", "execution_count": 2, "id": "c904ec9d-c533-42ec-afe9-4657d4e9f213", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "eps0, eps1, V, g, omega0 = -0.1, +0.1, 0.25, 1., 1.\n", "mu = -g**2 / omega0 # For half-filling at eps0 = 0" ] }, { "cell_type": "markdown", "id": "cbb15884-fdf0-4c08-a57a-e6711541ad9d", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "
\n", "\n", "**2.** construct a solver instance," ] }, { "cell_type": "code", "execution_count": 3, "id": "710e79a6-e2b5-4eac-a7d9-1f33a329ebdb", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Starting run with 1 MPI rank(s) at : 2026-03-11 10:21:51.593224\n" ] } ], "source": [ "from triqs_ctseg import Solver\n", "\n", "S = Solver(beta=10., n_tau_bosonic=1001,\n", " gf_struct = [[\"0\", 1], [\"1\", 1]]); # CTSEG requires two flavours or more, adding one inactive fermion" ] }, { "cell_type": "markdown", "id": "840d4260-08e9-4966-a74a-a52eeeb1a7a9", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "\n", "\n", "**3.** set the hybridization function $\\Delta(i\\nu_n) = \\frac{V^2}{i\\nu_n - \\epsilon_1}$," ] }, { "cell_type": "code", "execution_count": 4, "id": "ffad23a2-a375-44f7-8e81-e65f22ffd541", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "Delta_iw = make_gf_from_fourier(S.Delta_tau['0'])\n", "Delta_iw << V**2 * inverse(iOmega_n - eps1)\n", "S.Delta_tau['0'] << Fourier(Delta_iw);" ] }, { "cell_type": "markdown", "id": "ab4fa9b7-aaf5-4d54-9ee0-efdafc69a9c6", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "\n", "\n", "**4.** set the retarded interaction $\\mathcal{U}(i\\omega_n) = - 2g^2 \\frac{\\omega_0}{ \\omega_0^2 - (i\\omega_n)^2}$," ] }, { "cell_type": "code", "execution_count": 5, "id": "29938c11-19b5-4820-9a1b-e0d1b2811df3", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "D0_iw = make_gf_from_fourier(S.D0_tau['0','0'])\n", "D0_iw << -2 * g**2 * omega0 * inverse(omega0**2 - iOmega_n*iOmega_n);\n", "S.D0_tau[\"0\", \"0\"] << Fourier(D0_iw);" ] }, { "cell_type": "markdown", "id": "e5ff0fb9-56e7-46b7-b987-40690601fc1c", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "\n", "\n", "**5.** and finally, run the solver while passing the Hamiltonian $H_{0} = (\\epsilon_0 - \\mu) c^\\dagger_0 c_0$." ] }, { "cell_type": "code", "execution_count": 6, "id": "0adc4c09-1375-4993-ae2f-6f71dba85240", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "╔╦╗╦═╗╦╔═╗ ╔═╗ ┌─┐┌┬┐┌─┐┌─┐┌─┐\n", " ║ ╠╦╝║║═╬╗╚═╗ │ │ └─┐├┤ │ ┬\n", " ╩ ╩╚═╩╚═╝╚╚═╝ └─┘ ┴ └─┘└─┘└─┘\n", "\n", "\n", "Block: 0 Index: 0 Color: 0\n", "Block: 1 Index: 0 Color: 1\n", "\n", " Interaction matrix: U = \n", "[[0,0]\n", " [0,0]] \n", "\n", "Orbital energies: mu - eps = [-0.9,-0] \n", "\n", "\n", " Renormalized interaction matrix: U = \n", "[[0,0]\n", " [0,0]] \n", "\n", "Renormalized orbital energies: mu - eps = [0.100008,0] \n", "\n", "Dynamical interactions = true, Jperp interactions = false \n", "\n", "[Rank 0] Performing warmup phase...\n", "[Rank 0] 10:21:51 3.77% done, ETA 00:00:02, cycle 37653 of 1000000, 3.77e+05 cycles/sec\n", "[Rank 0] 10:21:53 82.59% done, ETA 00:00:00, cycle 825938 of 1000000, 3.89e+05 cycles/sec\n", "[Rank 0] 10:21:54 100.00% done, ETA 00:00:00, cycle 1000000 of 1000000, 3.90e+05 cycles/sec\n", "[Rank 0] Performing accumulation phase...\n", "[Rank 0] 10:21:54 0.30% done, ETA 00:00:33, cycle 30026 of 10000000, 3.00e+05 cycles/sec\n", "[Rank 0] 10:21:56 6.26% done, ETA 00:00:31, cycle 626337 of 10000000, 2.95e+05 cycles/sec\n", "[Rank 0] 10:21:58 13.66% done, ETA 00:00:29, cycle 1366104 of 10000000, 2.93e+05 cycles/sec\n", "[Rank 0] 10:22:02 23.04% done, ETA 00:00:26, cycle 2303792 of 10000000, 2.95e+05 cycles/sec\n", "[Rank 0] 10:22:05 34.70% done, ETA 00:00:22, cycle 3470255 of 10000000, 2.95e+05 cycles/sec\n", "[Rank 0] 10:22:10 49.55% done, ETA 00:00:17, cycle 4955324 of 10000000, 2.96e+05 cycles/sec\n", "[Rank 0] 10:22:17 67.81% done, ETA 00:00:10, cycle 6780908 of 10000000, 2.96e+05 cycles/sec\n", "[Rank 0] 10:22:24 90.58% done, ETA 00:00:03, cycle 9057730 of 10000000, 2.96e+05 cycles/sec\n", "[Rank 0] 10:22:27 100.00% done, ETA 00:00:00, cycle 10000000 of 10000000, 2.96e+05 cycles/sec\n", "[Rank 0] Collect results: Waiting for all MPI processes to finish accumulating...\n", "Densities:\n", " 0: [0.700541]\n", " 1: [0.49906]\n", "\n", "[Rank 0] Warmup duration: 2.5641 seconds [00:00:02]\n", "[Rank 0] Simulation duration: 33.7571 seconds [00:00:33]\n", "[Rank 0] Number of measures: 10000000\n", "[Rank 0] Cycles (measures) / second: 2.96e+05\n", "[Rank 0] Measurement durations (total = 7.3851):\n", "[Rank 0] Measure